
<?php 
$timeStamp = ISession::get('timeStamp');
$package = ISession::get('package');
$nonceStr = ISession::get('nonceStr');
$paySign = ISession::get('paySign');
$orderNo = ISession::get('orderNo');
echo "<script> var timeStamp = \"$timeStamp\"; </script>";
echo "<script> var package = \"$package\"; </script>";
echo "<script> var nonceStr = \"$nonceStr\"; </script>";
echo "<script> var paySign = \"$paySign\"; </script>";
echo "<script> var orderNo = \"$orderNo\"; </script>";
?>
<script>
$(function(){
    // 隐藏底部导航
    hideNav();
})

function onBridgeReady(){
   WeixinJSBridge.invoke(
       'getBrandWCPayRequest', {
           "appId":"wxda18d758438de540",     //公众号名称，由商户传入     
           "timeStamp":timeStamp,         //时间戳，自1970年以来的秒数     
           "nonceStr":nonceStr, //随机串     
           "package":package,     
           "signType":"MD5",         //微信签名方式：     
           "paySign":paySign //微信签名 
       },
       function(res){  
    	   //alert(res.err_msg);
           if(res.err_msg == "get_brand_wcpay_request:ok" ) {
        	   window.location.href = '{url:/block/wechatPayPost/_id/11/orderNo/'+orderNo+'}';
           }     // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。 
       }
   ); 
}

if (typeof WeixinJSBridge == "undefined"){
   if( document.addEventListener ){
       document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
   }else if (document.attachEvent){
       document.attachEvent('WeixinJSBridgeReady', onBridgeReady); 
       document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
   }
}else{
   onBridgeReady();
} 

</script>